﻿using MediatR;
using T_settlement.API.Application.Command.settlementCommand;
using T_settlement.Infrastructure.Interfacec;

namespace T_settlement.API.Application.CommandHandlers.settlementCommandHandlers
{
    public class DelSettlementCommandHandlers : IRequestHandler<DelSettlementCommand, int>
    {
        private readonly lsettlementRepository lsettlementRepository;

        public DelSettlementCommandHandlers(lsettlementRepository lsettlementRepository)
        {
            this.lsettlementRepository = lsettlementRepository;
        }

        public async Task<int> Handle(DelSettlementCommand request, CancellationToken cancellationToken)
        {
            var info =await lsettlementRepository.GetModelAsync(request.SettlementId);
            info.IsDel = true;
            return await lsettlementRepository.UpdateAsync(info);
        }
    }
}
